package cn.schoolwow.workflow.module.task.query.service;

import cn.schoolwow.quickdao.domain.DAO;
import cn.schoolwow.quickdao.domain.database.dql.condition.Condition;
import cn.schoolwow.quickflow.domain.FlowContext;
import cn.schoolwow.quickflow.flow.BusinessFlow;
import cn.schoolwow.workflow.domain.task.WorkFlowTaskResponse;
import cn.schoolwow.workflow.module.task.query.flow.SetTaskQueryConditionFlow;

import java.util.List;

public class GetTaskListServiceFlow implements BusinessFlow {
    @Override
    public void executeBusinessFlow(FlowContext flowContext) throws Exception {
        flowContext.executeFlowList(new SetTaskQueryConditionFlow());

        Condition condition = flowContext.checkInstanceData(Condition.class);
        DAO dao = flowContext.checkInstanceData(DAO.class);

        dao.addRecordString("查询工作流任务列表");
        List<WorkFlowTaskResponse> list = condition.execute().getList(WorkFlowTaskResponse.class);
        flowContext.putTemporaryData("list", list);
    }

    @Override
    public String name() {
        return "查询工作流任务列表服务流程";
    }
}
